package com.xmg.p2p.base.controller;

import com.xmg.p2p.business.query.BidRequestQueryObject;
import com.xmg.p2p.business.service.IBidRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @BelongsProject: jinrong-website
 * @BelongsPackage: com.xmg.p2p.base.controller
 * @author: Andy
 * @date: 2021.4.7 14:05
 * @Description: 首页控制器
 * @since JDK 1.8
 */
@Controller
public class IndexController {

    @Autowired
    private IBidRequestService bidRequestService;

    /**
     * 进入投资页面
     * @return 返回投资页面
     */
    @RequestMapping("invest")
    public String invest(){
        return "invest";
    }


    /**
     * 查看发标信息，Ajax请求
     * @param qo    条件的集合
     * @param model 模型
     * @return  返回到的页面
     */
    @RequestMapping("invest_list")
    public String investList(@ModelAttribute("qo")BidRequestQueryObject qo, Model model){
        model.addAttribute("pageResult",this.bidRequestService.query(qo));
        return "invest_list";
    }
}
